package com.easy;

import java.util.HashMap;
import java.util.Map;

/**
 * Created by Lxk on 2019/11/9.
 */
public class Solution697 {

    public int findShortestSubArray(int[] nums) {
        Map<Integer, Integer> numCounter = new HashMap<>();
        for (Integer val : nums) {
            if (numCounter.keySet().contains(val)) {
                numCounter.put(val, numCounter.get(val) + 1);
            } else {
                numCounter.put(val, 1);
            }
        }
        int du = 0;
        for (Map.Entry<Integer, Integer> entry : numCounter.entrySet()) {
            if (entry.getValue() > du) {
                du = entry.getValue();
            }
        }
        return du;
    }

}
